import request from '@/utils/request'

import type { responseDataType, listDataType } from './model'
import type { UserInfo } from './user.model'
const baseRequest = request.init(import.meta.env.VITE_APP_BASE_API)

// 获取用户信息
export function userList() {
  return baseRequest.get<any, responseDataType<listDataType<UserInfo>>>('api/auth/user')
}

// 新增用户
export function addUser(data: UserInfo) {
  return baseRequest.post<any, responseDataType<any>>('api/auth/user', data)
}

// 删除
export function deleteUser(id: number) {
  return baseRequest.delete<any, responseDataType<any>>(`api/auth/user/${id}`)
}
